<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<jsp:directive.page contentType="text/html" pageEncoding="UTF-8" />
<link type="text/css" rel="stylesheet"
	href="<c:url value="/resources/css/index.css" />" />

<html xmlns:jsp="http://java.sun.com/JSP/Page" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<spring:url value="/resources/img/library-logo.png" var="logo"/>

<spring:url value="/reg_init" var="login_init">
<spring:param name="login" value="true" />
</spring:url>
<spring:url value="/logout" var="logout"/>
<spring:url value="/reg_init" var="register">
<spring:param name="login" value="false" />
</spring:url>
<spring:url value="/browse" var="main_page"/>


<spring:message code="login" var="login_label"/>

</head>
<body>
 
 <div id = "centered">
<img src="${logo}" />
	<table id="header">
		<tr>
			<td><a href="${main_page}">To main
					page</a></td>			

			<c:choose>
		
				<c:when test="${curUser ne null}">
				 <spring:url value="/${curUser.userFName}/edit" var="edit_account"/>
				 <spring:url value="/${curUser.userFName}/books" var="user_library"/>
				  <spring:url value="/init_upload" var="upload"/>
					<td>
					Welcome, ${curUser.userFName}  
					 <a href="${logout}">Logout</a>  /  <a href="${edit_account}">Edit</a>
					</td>				
					<td><a href="${user_library}">Personal
					library</a></td>
					<td><a href="${upload}">Upload book</a></td>
					
					
				</c:when>
				<c:otherwise>
                     <td>
					<a href="${login_init}">Login</a>
					 </td>
					 <td>
								${login_label} /  <a href="${register}">Register</a>
							
                                </td>
                               
				</c:otherwise>
				
			</c:choose>
			
			<td> <a href="?lang=en">en</a>|<a href="?lang=ru">ru</a></td>
		</tr>
	</table>
	
	<br/>


<c:if test="${message ne null}">
 <input type='checkbox' style='display: none' id=cb>
    <label class = "label" for=cb>X</label>
<div class = "messages">
 ${message} 
  </div>
 
  </c:if>
  
  </div>
 
</body>
</html>